﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AircraftBattleServer
{
    [Serializable]
    public class Missile
    {
        public string id;
        public MyPoint position;
        /// <summary>
        /// orientation represents the direction where the 
        /// missile flies. It is the degree between fly route 
        /// and the x axis and increases counter-clockwise. The 
        /// value is between 0 and 360
        /// </summary>
        public double orientation;

        public Missile(string id, MyPoint pos, double orient)
        {
            this.id = id;
            this.position = pos;
            this.orientation = orient;
        }

        public void Move()
        {
            double radiun = ServerUtility.DegreeToRadiun(orientation);
            this.position.x += Math.Cos(radiun) * Constants.MissileDefaultSpeed;
            this.position.y += Math.Sin(radiun) * Constants.MissileDefaultSpeed;
        }
    }
}
